local skel = fk.CreateSkill {
  name = "lb__zhushi",
}

Fk:loadTranslationTable {
  ["lb__zhushi"] = "猪市",
  --[":lb__zhushi"] = "每回合限一次，当一名角色于其每轮第一个出牌阶段以外的阶段造成不大于1的伤害后，你可以弃置一张伤害牌并对受伤者造成1点同属性的伤害。",
  --10.5
  [":lb__zhushi"] = "每回合限一次，当一名角色于其每轮第一个出牌阶段以外的阶段造成不大于1的伤害后，你可以重铸一张伤害牌并对受伤者造成1点同属性的伤害。",

  ["#lb__zhushi"] = "猪市：你可以重铸一张伤害牌对 %dest 造成1点%arg伤害",

  ["$lb__zhushi1"] = "连本带息还债！",
  ["$lb__zhushi2"] = "账账，狠狠地砸！",
}

skel:addEffect(fk.Damage, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and player:usedSkillTimes(skel.name) == 0 and not player:isNude() and
        data.from and (data.from.phase ~= Player.Play or
          #player.room.logic:getEventsOfScope(GameEvent.Phase, 999, function(e)
            return e.data.who == data.from and e.data.phase == Player.Play
          end, Player.HistoryRound) ~= 1)
        and data.damage == 1 and not data.to.dead
  end,
  on_cost = function(self, event, target, player, data)
    local damage_card = table.filter(player:getCardIds("he"), function(id)
      return Fk:getCardById(id).is_damage_card
    end)
    local pattern = ".|.|.|.|.|.|" .. table.concat(damage_card, ",")
    local cards = player.room:askToCards(player, {
      min_num = 1,
      max_num = 1,
      pattern = pattern,
      include_equip = true,
      skill_name = skel.name,
      prompt = "#lb__zhushi::" .. data.to.id .. ":" .. Fk:getDamageNatureName(data.damageType),
    })
    if #cards > 0 then
      event:setCostData(self, {cards = cards})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:recastCard(event:getCostData(self).cards, player, skel.name)
    player.room:damage({
      from = player,
      to = data.to,
      damage = 1,
      damageType = data.damageType,
      skillName = skel.name,
    })
  end,
})

return skel
